<?php
class WareClass {

	public static function getbyid($id){
		return Db::get(__CLASS__)->select()->where(array('id'=>$id))->getOne();
	}

	public static function find($id){
		return self::getbyid($id);
	}

	public static function getForList($where){
		return Db::get(__CLASS__)->select()->where($where)->hkey('id')->order('id ASC')->getAll();
	}

	public static function add($data){
		return Db::get(__CLASS__)->insert($data)->exec() ? Db::get(__CLASS__)->insertId() : false;
	}
	public static function update($id, $data){
		return Db::get(__CLASS__)->update($data)->where(array('id'=>$id))->exec();
	}
}
?>
